Transfer Function Interactive Visualisation

This notebook shows
(1) how to use the interactive widget
(2) applies it to an interactive visualisation of the transfer function used in cellnopt (ODE).


In [1]:
from IPython.html.widgets import interact
from IPython.display import Latex
%pylab inline


Populating the interactive namespace from numpy and matplotlib

In [2]:
Latex(r"""\begin{equation}T(x,\tau,k,n) = \tau  \frac{\left( k^n+1 \right) x^n}{k^n+x^n}\end{equation}""")


Out[2]:
\begin{equation}T(x,\tau,k,n) = \tau \frac{\left( k^n+1 \right) x^n}{k^n+x^n}\end{equation}

In [4]:
from cno.misc import matfun

In [5]:
matfun.plot_ode_transfer_function(1, {'A':{'k':1, 'n':.5, 'type':1}})



In [6]:
def test1(tau, k,n, type_):
    matfun.plot_ode_transfer_function(tau, {'A':{'k':k, 'n':n, 'type':type_}})
    plt.ylim([0,1])

In [7]:
interact(test1, tau=(0.,10.), k=(0.,1,.001), n=(0.,5), 
         type_={'activation':1, 'inhibition':-1} )



In [8]:
def test2(tau, k1,k2,n1,n2, type1,type2,ymax=1):
    matfun.plot_ode_transfer_function(tau, {'A':{'k':k1, 'n':n1, 'type':type1},
                                            
                                            'B':{'k':k2, 'n':n2, 'type':type2}
                                            })
    plt.ylim([0,ymax])

In [9]:
interact(test2, tau=(0.,10.), k1=(0.,1,.001), n1=(0.,5), n2=(0.,5.),k2=(0,1,0.001), type1={'activation':1, 'inhibition':-1},
         type2={'activation':1, 'inhibition':-1},ymax=(0,2))


Out[9]:
<function __main__.test2>

In [ ]: